package com.wifi.channerClass.service;

import com.wifi.channerClass.dao.ChannelClassDao;
import com.wifi.channerClass.dao.ChannelClassDaoImp;
import com.wifi.channerClass.entity.ChannelClassEntity;

import java.sql.SQLException;
import java.util.List;

public class ChannelClassServiceImp implements  ChannelClassService {

      ChannelClassDao dao=new ChannelClassDaoImp();


    @Override
    public List<Object> getDatePage(Integer pageNum, Integer pageSize, String pid) {
        try {
            return dao.selectData(pageNum,pageSize,pid);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return null;
    }

    @Override
    public long selectCount(String pid) {
        try {
            return  dao.selectCount(pid);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return 0;
    }


    @Override
    public List<Object> getfather() {
        try {
            return dao.selectFather();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return null;
    }

    @Override
    public long insert(String name, int pid) {
        try {
           return  dao.insert(name,pid);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public  long remove(int id, int s) {
        try {
            long remove = dao.remove(id,s);
            return  remove;
        } catch (SQLException e) {
            e.printStackTrace();
        }return  0;
    }

    @Override
    public Object queryByid(String id) {
        try {
            return dao.selectById(Integer.valueOf(id));
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return null;

    }

    @Override
    public int edit(ChannelClassEntity channelClassEntity) {
        try {
            return dao.editByname(channelClassEntity);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return 0;
    }
}
